package wiki.hitime.stl.daq.mapper;

import wiki.hitime.stl.daq.bean.db.DaqAcquisitionDataRecord;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;
import tk.mybatis.mapper.common.Mapper;
import tk.mybatis.mapper.common.MySqlMapper;

import java.util.List;

/**
 * 数据采集数据记录表(DaqAcquisitionDataRecord)表数据库访问层
 *
 * @author zhangdp
 * @since 2019-07-15 16:59:55
 */
@Repository
public interface DaqAcquisitionDataRecordMapper extends Mapper<DaqAcquisitionDataRecord>, MySqlMapper<DaqAcquisitionDataRecord> {

    /**
     * 批量添加
     *
     * @param daqAcquisitionDataRecordList
     * @return
     */
    @Insert("<script>" +
            "INSERT INTO daq_acquisition_data_record " +
            "        (" +
            "        `acquisition_record_id`," +
            "        `data_a`) " +
            "        VALUES" +
            "        <foreach collection='list' item='itemValue' separator=','>" +
            "            (#{itemValue.acquisitionRecordId}," +
            "            #{itemValue.dataA})" +
            "        </foreach>" +
            "</script>")
    int batchAdd(@Param("list") List<DaqAcquisitionDataRecord> daqAcquisitionDataRecordList);

}
